<template>
  <div class="caca">
    <div class="day">
      <dl>
        <dd v-for="item in mainlist">
          <img v-lazy="getImg('task1.png')" alt="" />
          <div>
            <p>
              {{ $t(item.text) }}
              <el-icon size="14" @click="visible = true"
                ><QuestionFilled
              /></el-icon>
            </p>
            <div>
              <i>0</i>
              <i>/</i>
              <i>100</i>
            </div>
            <span
              >{{ $t("language.task.price") }}:{{ $t("language.task.money")
              }}{{ item.money }}</span
            >
          </div>
          <span @click="$openPage('/home')">{{
            $t("language.task.complete")
          }}</span>
        </dd>
      </dl>
    </div>
  </div>
  <!--  :title="$t('language.task.dialogtitle')" -->
  <el-dialog v-model="visible" center :show-close="false" width="80%">
    <div class="taskdialog">
      <p>
        {{ $t("language.task.dialoguser") }}
      </p>
      <p>{{ $t("language.task.dialogtext1") }}</p>
      <p>{{ $t("language.task.dialogtext2") }}</p>
      <p>{{ $t("language.task.dialogtwo") }}</p>
      <p>{{ $t("language.task.dialog1") }}</p>
      <p>{{ $t("language.task.dialog2") }}</p>
      <span @click="visible = false">{{ $t("language.task.tipsbtn") }}</span>
    </div>
    <template #header="{ close }">
      <div class="my-header">
        <h4>{{ $t("language.task.dialogtitle") }}</h4>
        <el-icon color="#fff" @click="close"><Close /></el-icon>
      </div>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import { ref, reactive } from "vue";
const getImg = (url) => {
  return new URL(`../../../assets/img/${url}`, import.meta.url).href;
};
let activeindex = ref(0);

const visible = ref(false);
let mainlist = reactive([
  {
    date: "day1",
    text: "language.task.day1task1",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day1",
    text: "language.task.day1task2",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day1",
    text: "language.task.day1task3",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day1",
    text: "language.task.day1task4",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day2",
    text: "language.task.day2task1",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day2",
    text: "language.task.day2task2",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day2",
    text: "language.task.day2task3",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day2",
    text: "language.task.day2task4",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day3",
    text: "language.task.day3task1",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day3",
    text: "language.task.day3task2",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day3",
    text: "language.task.day3task3",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day3",
    text: "language.task.day3task4",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day4",
    text: "language.task.day4task1",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day4",
    text: "language.task.day4task2",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day4",
    text: "language.task.day4task3",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day4",
    text: "language.task.day4task4",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day5",
    text: "language.task.day5task1",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day5",
    text: "language.task.day5task2",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day5",
    text: "language.task.day5task3",
    money: "10.00",
    jf: "1000",
  },
  {
    date: "day5",
    text: "language.task.day5task4",
    money: "10.00",
    jf: "1000",
  },
]);
let dayt = ref("day1");
let list = reactive([]);
let chooseDate = (day: string, index) => {
  activeindex.value = index;
  dayt.value = day;
  list = mainlist.filter((i) => i.date == dayt.value);
};
chooseDate(dayt.value, 0);
</script>

<style lang="scss">
.el-dialog__header {
  padding: 0;
}
.el-dialog__title {
  color: #fff !important;
  text-align: left !important;
}
.el-dialog {
  padding: 20px !important;
  background-color: rgb(49, 53, 62) !important;
  --el-dialog-bg-color: rgb(49, 53, 62) !important;
  border-radius: 15px;
}

.caca {
  width: 100%;
  padding: 0 10px;
  .day {
    width: 100%;
    border: solid 1px #4a4c53;
    padding: 10px 15px;
    border-radius: 15px;

    height: 80vh;
    overflow-y: scroll;
    &::-webkit-scrollbar {
      width: 0;
      height: 0;
      display: none;
    }
    dl {
      @include flex(column, center, center);
      dd {
        width: 100%;
        border-radius: 10px;
        padding: 10px;
        margin-bottom: 10px;
        background-color: rgb(36, 38, 43);
        @include flex(row, center, center);
        border: solid 1px #4a4c53;
        div {
          flex: 1;
        }
        img {
          width: 30px;
          margin-right: 10px;
        }
        > div {
          margin-right: 10px;
          @include flex(column, center, flex-start);
          p {
            font-size: 14px;
            color: #95979e;
            line-height: 16px;
            position: relative;
            width: 100%;
            .el-icon {
              position: absolute;
              right: 0;
              top: 50%;
              margin-top: -7px;
            }
          }
          div {
            width: 100%;
            height: 20px;
            background-color: rgb(60, 64, 74);
            border-radius: 10px;
            @include flex(row, center, center);
            i {
              font-style: normal;
              color: #fff;
              font-size: 14px;
            }
          }
          span {
            color: #fff;
            font-size: 14px;
          }
        }
        > span {
          font-size: 12px;
          color: #0a906c;
          display: block;
          height: 26px;
          @include flex(row, center, center);
          border-radius: 10px;
          border: 1px solid #0a906c;
          padding: 0 5px;
        }
      }
    }
  }
}
.my-header {
  @include flex(row, space-between, center);
  width: 100%;
  margin-bottom: 30px;
  h4 {
    color: #fff;
  }
}
.taskdialog {
  padding: 0 10px;
  p {
    color: #95979e;
    font-size: 14px;
    line-height: 22px;
  }
  span {
    background-color: #0a906c;
    width: 120px;
    display: block;
    margin: 30px auto 15px;

    color: #fff;
    border-radius: 20px;
    height: 40px;
    text-align: center;
    line-height: 40px;
  }
}
</style>
